package WinterHomework.day03;

// 一球从100米高度自由落下，每次落地后反跳回原高度的一半，再落下，求它在第10次落地时，共经过多少米
public class Demo01 {
    public static void main(String[] args) {
        double hight = 100;
        int n = 10;
        double sum = 100;
        double x = 0;
        for (int i = 0; i < 10; i++) {
            sum += x;
            hight /= 2.0;
            x = hight * 2;
        }
        System.out.println("共经过：" + sum);
        System.out.println("第" + n + "次反弹：" + hight);
    }
}
